package com.dhcc.DRGsHosp.web.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.openkoala.koala.commons.InvokeResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.dhcc.DRGsHosp.facade.MedicalRecordQualityFacade;

/**
 * 
 * @title		:MedicalRecordQualityController.java
 * @description	:病案首页质量分析
 * @author		:chenhanlin
 * @date		:2018年08月06日
 */
@Controller()
@RequestMapping("/medicalRecordQuality")
public class MedicalRecordQualityController {
		
	@Autowired
	private MedicalRecordQualityFacade medicalRecordQualityFacade;

	/**
	 * @Description: 病案质量 病例汇总
	 * @param  
	 * @return  
	 * @throws
	 * @author chenhanlin
	 * @date 2018/8/6 15:10 
	 */
	@ResponseBody
	@RequestMapping("/overviewMRCount")
	public InvokeResult overviewMRCount(@RequestParam Map<String,Object> condition){
		List<Map<String,Object>> resultList =  medicalRecordQualityFacade.overviewMRCount(condition) ;
		return InvokeResult.success(resultList);
	}

	/**
	 * @Description: 病案质量 病例汇总
	 * @param
	 * @return
	 * @throws
	 * @author chenhanlin
	 * @date 2018/8/6 15:10
	 */
	@ResponseBody
	@RequestMapping("/loadMRQualityCaseDtl")
	public InvokeResult loadMRQualityCaseDtl(@RequestParam Map<String,Object> condition){
		Map<String,Object> resultMap =  medicalRecordQualityFacade.loadMRQualityCaseDtl(condition) ;
		return InvokeResult.success(resultMap);
	}
	/**
	 * @Description: 病案质量 质控项汇总
	 * @param
	 * @return
	 * @throws
	 * @author chenhanlin
	 * @date 2018/8/6 15:10
	 */
	@ResponseBody
	@RequestMapping("/overviewItemCount")
	public InvokeResult overviewItemCount(@RequestParam Map<String,Object> condition){
		List<Map<String,Object>> resultList =  medicalRecordQualityFacade.overviewItemCount(condition) ;
		return InvokeResult.success(resultList);
	}

	/**
	 * @Description: 质控分数统计
	 * @param
	 * @return
	 * @throws
	 * @author chenhanlin
	 * @date 2018/8/6 15:10
	 */
	@ResponseBody
	@RequestMapping("/queryScore")
	public InvokeResult queryScore(@RequestParam Map<String,Object> condition){
		List<Map<String,Object>> resultList =  medicalRecordQualityFacade.queryScore(condition) ;
		return InvokeResult.success(resultList);
	}

	/**
	 * @Description: 查询各项的满分分数
	 * @param
	 * @return
	 * @throws
	 * @author chenhanlin
	 * @date 2018/8/6 15:10
	 */
	@ResponseBody
	@RequestMapping("/initializeFullScore")
	public InvokeResult initializeFullScore(){ 
		return medicalRecordQualityFacade.initializeFullScore() ;
	}

	/**
	 * @Description: 查询违规项
	 * @param
	 * @return
	 * @throws
	 * @author chenhanlin
	 * @date 2018/8/6 15:10
	 */
	@ResponseBody
	@RequestMapping("/violationItems")
	public InvokeResult violationItems(@RequestParam Map<String,Object> condition){
		List<Map<String,Object>> resultList =  medicalRecordQualityFacade.violationItems(condition) ;
		return InvokeResult.success(resultList);
	}

	/**
	 * @Description: 查询违规项
	 * @param
	 * @return
	 * @throws
	 * @author chenhanlin
	 * @date 2018/8/6 15:10
	 */
	@ResponseBody
	@RequestMapping("/violationDeps")
	public InvokeResult violationDeps(@RequestParam Map<String,Object> condition){
		List<Map<String,Object>> resultList =  medicalRecordQualityFacade.violationDeps(condition) ;
		return InvokeResult.success(resultList);
	}
	/**
	 * @Description: 开始批量质控
	 * @param
	 * @return
	 * @throws
	 * @author chenhanlin
	 * @date 2018/8/6 15:10
	 */
	@ResponseBody
	@RequestMapping("/startBatchAnalysis")
	public InvokeResult batchMedicalRecordQualityAnalysis(String dateFrom, String dateTo,String dateType,String batchSize){
		Map<String,Object> condition = new HashMap<String,Object>();
		condition.put("dateFrom", dateFrom);
		condition.put("dateTo", dateTo);
		condition.put("dateType", dateType);
		condition.put("pageSize", batchSize);
		medicalRecordQualityFacade.batchMedicalRecordQualityAnalysis(condition);
		return InvokeResult.success();
	}
	/**
	 * @Description: 获取批量质控的进度信息
	 * @param
	 * @return
	 * @throws
	 * @author chenhanlin
	 * @date 2018/8/6 15:10
	 */
	@ResponseBody
	@RequestMapping("/getBatchAnalysisParameter")
	public InvokeResult getBatchAnalysisParameter(){
		return InvokeResult.success(medicalRecordQualityFacade.getBatchAnalysisParameter());
	}
}
